Skip to content

[mlir][dxsa] Add root dxsa.module#155

Merged
tagolog merged 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-program-header
Jun 7, 2026
Merged

[mlir][dxsa] Add root dxsa.module#155
tagolog merged 1 commit into
access-softek:dxsa-mlirfrom
tagolog:dxsa-mlir-program-header

Conversation

@tagolog

@tagolog tagolog commented May 31, 2026

Copy link
Copy Markdown

Wraps the program into a module with optional attributes program type and shader version. When the binary has no header both attributes are omitted.

Example:
dxsa.module pixel_shader 5 0 {
dxsa.dcl_global_flags
}

dxsa.module {
dxsa.dcl_global_flags
}

@tagolog tagolog requested a review from asavonic May 31, 2026 08:02

@asavonic asavonic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

Comment thread mlir/lib/Dialect/DXSA/IR/DXSA.cpp
Comment thread mlir/lib/Dialect/DXSA/IR/DXSA.cpp Outdated
Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated
Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated
Comment thread mlir/include/mlir/Target/DXSA/BinaryParser.h Outdated
@tagolog tagolog force-pushed the dxsa-mlir-program-header branch from 82eb011 to 6b59659 Compare June 1, 2026 23:28
@tagolog tagolog requested a review from asavonic June 1, 2026 23:32

@asavonic asavonic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated
if (DECODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(versionToken) != 0)
return std::optional<ProgramHeader>{};

auto rawType = static_cast<uint32_t>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems concise to me:

uint32_t rawType = DECODE_D3D10_SB_TOKENIZED_PROGRAM_TYPE(versionToken);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread mlir/lib/Target/DXSA/BinaryParser.cpp Outdated

auto versionToken = support::endian::read<uint32_t>(
buffer.begin() + currentTokenOffset, endianness::little);
if (DECODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(versionToken) != 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we expect PROGRAM_TYPE length to always be 0, then it should be an error. If it is not followed by a length token, it is also an error.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Wraps the program into a module with optional attributes program type and shader version.
When the binary has no header both attributes are omitted.

Example:
  dxsa.module pixel_shader 5 0 {
    dxsa.dcl_global_flags <refactoringAllowed>
  }

  dxsa.module {
    dxsa.dcl_global_flags <refactoringAllowed>
  }

Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
@tagolog tagolog force-pushed the dxsa-mlir-program-header branch from 6b59659 to 0b18ddc Compare June 7, 2026 08:25
@tagolog tagolog merged commit bc69c6d into access-softek:dxsa-mlir Jun 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants